<template>
  <div>
    <basic-container>
      <!-- <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item>
          <div style="color: red; font-size: 28px">￥{{ payAmount }}</div>
        </el-form-item>
        <el-form-item label="支付宝账号" prop="name">
          <el-input style="width: 200px" v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handlPay()">确定</el-button>
        </el-form-item>
      </el-form> -->
    </basic-container>
  </div>
</template>

<script>
import { giftPay, pcPay } from "@/api/wel";

export default {
  data() {
    return {
      paySn: null,
      payAmount: null,
    };
  },
  created() {
    this.getGiftPay();
  },
  methods: {
    getGiftPay() {
      giftPay().then((res) => {
        if (res.data.code === 200) {
          this.payAmount = res.data.data.payAmount;
          this.paySn = res.data.data.paySn;
          this.handlPay();
        }
      });
    },
    handlPay() {
      let params = {
        outTradeNo: this.paySn,
        totalAmount: this.payAmount,
        platformId: 2,
        storeId: 0,
      };

      pcPay(params).then((res) => {
        const div = document.createElement("div");
        div.innerHTML = res.data;
        document.body.appendChild(div);
        document.forms[0].submit();
      });
      // this.$http.get("http://192.168.0.172:8090/yms-api/aliPay/pcPay", {
      //   params: params
      // }).then(function (res) {
      //   const div = document.createElement("div");
      //   div.innerHTML = res.data;
      //   document.body.appendChild(div);
      //   document.forms[0].submit();
      // });

    },
  },
};
</script>

<style scoped="scoped" lang="scss">
</style>
